package com.kifas.entity;

import java.io.Serializable;
import java.util.List;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.ManyToMany;
import javax.persistence.OneToMany;
import javax.persistence.Table;

@Entity
@Table(name = "tb_groups")
public class GroupEntity implements Serializable {

	private static final long serialVersionUID = 5873209938349837843L;

	@Id
	@GeneratedValue
	@Column(name = "id_group")
	private Long idGroup;

	private String name;

	private boolean enable;

	@ManyToMany(mappedBy = "groups", fetch = FetchType.LAZY)
	private List<UserEntity> users;
	
	@OneToMany(mappedBy = "group", targetEntity = MenuEntity.class, fetch = FetchType.LAZY)
	private List<MenuEntity> menus;

	public GroupEntity() {
	}

	public GroupEntity(Long idGroup, String name, boolean enable) {
		this.idGroup = idGroup;
		this.name = name;
		this.enable = enable;
	}

	public Long getIdGroup() {
		return idGroup;
	}

	public void setIdGroup(Long idGroup) {
		this.idGroup = idGroup;
	}

	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}

	public boolean isEnable() {
		return enable;
	}

	public void setEnable(boolean enable) {
		this.enable = enable;
	}

	public void setUsers(List<UserEntity> users) {
		this.users = users;
	}

	public List<UserEntity> getUsers() {
		return users;
	}

	public void setMenus(List<MenuEntity> menus) {
		this.menus = menus;
	}

	public List<MenuEntity> getMenus() {
		return menus;
	}

}
